#include <stdio.h>
#include <time.h>

#define V 1 << 23

long v[V];

void sub(int x)
{
	struct timespec a, b;
	clock_gettime(CLOCK_MONOTONIC, &a);
	v[x] = 0;
	__builtin_ia32_mfence();
	clock_gettime(CLOCK_MONOTONIC, &b);
	printf("%ld\n", b.tv_nsec - a.tv_nsec);
}

int main()
{
	sub(0);
	for (int i = 0; i < V; ++i)
		v[i] = 0;
	__builtin_ia32_mfence();
	sub(0);
	sub(0);
	return 0;
}
